<template>
    <div class="container">
      <!-- 查询条件区域 -->
      <el-form :inline="true" :model="form" class="filter-form">
        <el-form-item label="集合编号">
          <el-input v-model="form.code" placeholder="请输入集合编号"></el-input>
        </el-form-item>
        <el-form-item label="集合名称">
          <el-input v-model="form.name" placeholder="请输入集合名称"></el-input>
        </el-form-item>
        <el-form-item label="内容体裁">
          <el-select v-model="form.contentType" placeholder="请选择">
            <el-option label="全部" value=""></el-option>
            <el-option label="竖版视频" value="vertical"></el-option>
            <el-option label="图文" value="image-text"></el-option>
            <el-option label="横版视频" value="horizontal"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="筛选方式">
          <el-select v-model="form.filterType" placeholder="请选择">
            <el-option label="全部" value=""></el-option>
            <el-option label="人工筛选" value="manual"></el-option>
            <el-option label="智能筛选" value="ai"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="创建时间">
          <el-date-picker
            v-model="form.createTime"
            type="daterange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
          ></el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="handleQuery">查询</el-button>
          <el-button @click="handleReset">重置</el-button>
        </el-form-item>
      </el-form>
  
      <!-- 表格区域 -->
      <el-table
        :data="tableData"
        border
        style="width: 100%; margin-top: 20px"
        :header-cell-style="headerCellStyle"
      >
        <el-table-column prop="code" label="集合编号" align="center"></el-table-column>
        <el-table-column prop="name" label="集合名称" align="center"></el-table-column>
        <el-table-column prop="contentType" label="内容体裁" align="center">
          <template slot-scope="scope">
            <span :class="['content-tag', `type-${scope.row.contentType}`]">
              {{ scope.row.contentTypeText }}
            </span>
          </template>
        </el-table-column>
        <el-table-column prop="filterType" label="筛选方式" align="center">
          <template slot-scope="scope">
            <span>{{ scope.row.filterType === 'manual' ? '人工筛选' : '智能筛选' }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="contentCount" label="内容量" align="center"></el-table-column>
        <el-table-column prop="createTime" label="创建时间" align="center"></el-table-column>
        <el-table-column label="操作" align="center" width="180">
          <template slot-scope="scope">
            <el-button
              type="text"
              icon="el-icon-view"
              @click="handleView(scope.row)"
            >查看</el-button>
            <el-button
              type="text"
              icon="el-icon-edit"
              style="color: #66b1ff"
            >编辑</el-button>
            <el-button
              type="text"
              icon="el-icon-delete"
              style="color: #f56c6c"
            >删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
  </template>
  
  <script>
  export default {
    name: 'DataSource',
    data() {
      return {
        form: {
          code: '',
          name: '',
          contentType: '',
          filterType: '',
          createTime: ''
        },
        tableData: [
          {
            code: 'COLL001',
            name: '热门视频集合',
            contentType: 'vertical',
            contentTypeText: '竖版视频',
            filterType: 'ai',
            contentCount: 152,
            createTime: '2023-04-01'
          },
          // 更多示例数据...
        ]
      }
    },
    methods: {
      headerCellStyle() {
        return 'background-color: #f5f7fa; color: #606266; font-weight: bold;'
      },
      handleQuery() {
        console.log('查询参数:', this.form)
      },
      handleReset() {
        this.form = {
          code: '',
          name: '',
          contentType: '',
          filterType: '',
          createTime: ''
        }
      },
      handleView(row) {
        console.log('查看集合:', row)
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  /* 容器样式 */
  .container {
    padding: 20px;
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  }
  
  /* 查询表单样式 */
  .filter-form {
    ::v-deep .el-form-item {
      margin-bottom: 18px;
      
      .el-form-item__label {
        font-weight: bold;
        color: #303133;
      }
      
      .el-input, .el-select {
        width: 180px;
      }
      
      .el-date-editor {
        width: 260px;
      }
    }
    
    ::v-deep .el-button {
      margin-left: 10px;
      
      &[type="primary"] {
        background-color: #409eff;
        border-color: #409eff;
      }
    }
  }
  
  /* 内容体裁标签样式 */
  .content-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    
    &.type-vertical {
      background-color: #f56c6c;
      color: #fff;
    }
    
    &.type-image-text {
      background-color: #67c23a;
      color: #fff;
    }
    
    &.type-horizontal {
      background-color: #409eff;
      color: #fff;
    }
  }
  
  /* 表格样式调整 */
  ::v-deep .el-table {
    th {
      background-color: #f5f7fa !important;
      color: #606266;
      font-weight: bold;
    }
    
    td {
      color: #303133;
      font-size: 14px;
    }
    
    .el-button--text {
      padding: 0;
      
      + .el-button--text {
        margin-left: 12px;
      }
    }
  }
  </style>